<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />


<atleap:content identifier="information" ignore="true" />

<atleap:message key="core.statistics.visit.form.unknown" var="unknownUserAgent" />

<table cellpadding="0" cellspacing="0" border="0" class="tableView">
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.date" /></th>
        <td>
            <atleap:formatDate value="${requestScope.visit.date}" type="datetime" />
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.url" /></th>
        <td><c:out value="${requestScope.visit.url}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.page" /></th>
        <td>
            <c:if test="${requestScope.visit.page != null}">
                <atleap:content identifier="description" uri="${requestScope.visit.page.uri}" filter="true" var="description" />
                <atleap:link action="${requestScope.visit.page.uri}" target="_blank" title="${description}">
                    <atleap:content identifier="title" uri="${requestScope.visit.page.uri}" />
                </atleap:link>
            </c:if>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.contentResource" /></th>
        <td>
            <c:if test="${requestScope.visit.contentResource != null}">
                <atleap:fieldValue valueMap="${requestScope.visit.contentResource.description}" var="description" filter="true" />
                <atleap:link action="${requestScope.visit.contentResource.uri}" target="_blank" title="${description}">
                    ${description}
                </atleap:link>
            </c:if>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.referrer" /></th>
        <td><c:out value="${requestScope.visit.referrerUrl}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.ip" /></th>
        <td><c:out value="${requestScope.visit.ip}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.browser" /></th>
        <td>
            <c:choose>
                <c:when test="${requestScope.visit.userAgent.browserDescription != null}">
                    <c:out value="${requestScope.visit.userAgent.browserDescription.title}" escapeXml="true" />
                </c:when>
                <c:otherwise>
                    ${unknownUserAgent}
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.os" /></th>
        <td>
            <c:choose>
                <c:when test="${requestScope.visit.userAgent.osDescription != null}">
                    <c:out value="${requestScope.visit.userAgent.osDescription.title}" escapeXml="true" />
                </c:when>
                <c:otherwise>
                    ${unknownUserAgent}
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.robot" /></th>
        <td>
            <c:choose>
                <c:when test="${requestScope.visit.userAgent.robotDescription != null}">
                    <c:out value="${requestScope.visit.userAgent.robotDescription.title}" escapeXml="true" />
                </c:when>
                <c:otherwise>
                    ${unknownUserAgent}
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.user" /></th>
        <td>
            <c:if test="${requestScope.visit.user != null}">
                <c:out value="${requestScope.visit.user.name}" escapeXml="true" />
            </c:if>
        </td>
    </tr>
    <tr>
        <th align="left" width="50%"><atleap:message key="core.statistics.visit.form.screenInfo" /></th>
        <td><c:out value="${requestScope.visit.screenInfo}" escapeXml="true" /></td>
    </tr>
</table>

<atleap:form action="core/statistics/visits" method="GET" validateOnSubmit="false">
    <html:hidden property="sessionNumber" value="${requestScope.visit.sessionNumber}" />
    <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.back" /></atleap:submit>
</atleap:form>
